import pygame
import projectile
import barlines
import math

class Bullet(projectile.Projectile):
    def __init__(self,position,bar_line):
        super(Bullet,self).__init__()
        self._vConst = 10
        self.velocity = 10
        self.img = pygame.image.load("../media/images/inkblot.png").convert_alpha()
        self.rect = self.img.get_rect()
        self.rect.centerx = 125
        self.rect.centery = position
        self.bar = bar_line
        self.locY = position
    def update(self,time):
        self.velocity = self._vConst * time
        self.rect.centery = math.fabs(self.bar.curveLoc(self.rect.x)+self.locY-(self.bar.locY))
        self.rect.move_ip(self.velocity,0)
    def draw(self,screen):
        screen.blit(self.img,self.rect)
    def collided(self,screen_rect):
        if self.rect.right > screen_rect.right:
            return True
        else:
            return False
